<?php
/**
 * Created by PhpStorm.
 * User: ZT
 * Date: 2017/12/12 0012
 * Time: 下午 4:17
 */
namespace frontend\controllers;
use common\models\info\Album;
use common\models\info\Article;
use common\models\info\Photo;
use frontend\component\FrontendBaseController;
use frontend\service\ArticleService;
use frontend\service\TravelService;
use yii\web\Controller;
class TravelController extends FrontendBaseController{
    public $layout = "/no_right";
    public function actionIndex(){
        $travel = TravelService::getTravelPhoto();
        $result =[
            'data' => $travel,
            'randomArticle' => Article::arrRandomRecommend(0, '', 1, 5),   //热门文章
            'hotArticle' =>  Article::arrHotArticle('hot', 1, 7, '')      //z最新文章
        ];
        return $this->render('index',$result);
    }
    public function actionPhoto(){
        $get = \Yii::$app->request->get();
           $post['id'] = $get['aid'];
          $result = Photo::getAllList($post);
        $model = Album::findOne($get['aid']);
           return $this->render('photo',[
               'data'=>$result,
               'row'=>$model->attributes,
           ]);
    }
}